package springbootreactor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


import reactor.bus.EventBus;
import reactor.spring.context.annotation.Consumer;
import reactor.spring.context.annotation.ReplyTo;
import reactor.spring.context.annotation.Selector;

import javax.annotation.Resource;

@Consumer
public class SayhitReplyHandler {
    @Resource
    private EventBus eventBus;


    private static Log log=LogFactory.getLog(SayhitReplyHandler.class);

    @Selector(value="testSayhitReply1")
    @ReplyTo(value="testSayhitReplyResult1")
    public String onTestSayhitReply1(String s){
        String to="Hello "+s;
        log.info("onTestSayhitReply1: in:"+s);
        return to;
    }

    @Selector(value="testSayhitReply2")
    @ReplyTo
    public String onTestSayhitReply2(String s){
        String to="Hello "+s;
        log.info("onTestSayhitReply2: in:"+s);
        return to;
    }

    @Selector(value="testSayhitReply3")
    @ReplyTo("testSayhitResult")
    public String onTestSayhitReply3(String s){
        String to="Hello "+s;
        log.info("onTestSayhitReply3: in:"+s);
        return to;
    }

    @Selector(value="testSayhitReplyResult1")
    public void onTestSayhitResult1(String result){
        log.info("onTestSayhitReplyResult1:"+result);

    }
    @Selector(value="testSayhitReplyResult2")
    public void onTestSayhitResult2(String result){
        log.info("onTestSayhitReplyResult2:"+result);

    }

}